@include('widget.admin.adminnav',['url'=>'/index.php/admin/area/list'
,'name'=>'地区列表','title'=>'地区管理','addUrl'=>'/index.php/admin/area/add','searchTitle'=>'添加地区','placeHolder'=>'搜索地区'])
<table class="table table-hover table-bordered">
    <tr>
        <th>id</th>
        <th>地区名称</th>
        <th>地区简介</th>
        <th>封面图片</th>
        <th>活动类型</th>
        <th>创建时间</th>
        <th>操作</th>
    </tr>
    @foreach($items as $item)
        <tr index="{$vo.admin_id}">
            <td>{{$item->id}}</td>
            <td>{{$item->name}}</td>
            <td style="max-width: 100px;">{!! mb_substr($item->intro,0,20) !!}</td>
            <td>
                <img src="{{$item->cover}}" style="display: inline-block;width: 75px;height: 50px;">
            </td>
            <td>{{$item->getActivity->name}}</td>
            <td>{{$item->created_at}}</td>
            <td>
                <a href="/index.php/admin/area/edit/{{$item->id}}" class="btn btn-primary"><span class="glyphicon glyphicon-edit"></span></a>
                <button class="btn btn-danger del" value="{{$item->id}}"><span class="glyphicon glyphicon-trash"></span></button>
            </td>
        </tr>
    @endforeach
</table>
<div  style="text-align: center;">
    <?php echo $items->render()?>
</div>
<script>
    $(".btn-primary").click(function () {
        var username = $(".username").val();
        if (username == ''){
            return;
        }
        var url = '/index.php/admin/area/list/'+ username;
        location.href=url;
    });

    $(".del").click(function () {
        var id = $(this).val();
        var _data = {
            id : id
        };
        var Url = '/index.php/admin/area/delete';
        dialog.confirm("确认删除？",function callback(){
            $.ajax({
                type:"post",
                data:_data,
                url:Url,
                dataType:"json",
                success:function(data){
                    if(data.res==1){
                        var _url='/index.php/admin/area/list'
                        dialog.success("操作成功！",_url);
                    }else{
                        dialog.error(data.msg);
                    }
                }
            });
        });
    });
</script>